// var o;
// exports.GameData = void 0;
// var $storageClass = require("../../resources/scripts/AL_Framework_Storage_Class");
// var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
// var AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
// var AL_GAME_HUA_LevelConfig = require("./AL_GAME_HUA_LevelConfig");
// var l = {
//     gametype: !1,
//     unlockLevel: 1,
//     specialUnlockLevel: 1,
//     starnum: 0,
//     propnum: [3, 3, 3, 10, 10, 10, 10],
//     awardnum: 0,
//     starBoxNum: 0,
//     propunlock: [!1, !1, !1, !1, !1, !1, !1],
//     curDifficult: 0,
//     todayChallenge: !1,
//     todayChallengePop: !0,
//     specialAwardNum: 0,
//     gameTheme: 0
// };
// var u = (function (e) {
//     function t() {
//         var t = (null !== e && e.apply(this, arguments)) || this;
//         t.useTipsEnter = !1;
//         t.useTimeEnter = !1;
//         t.useStarEnter = !1;
//         t.handleMode = 1;
//         return t;
//     }
//     __extends(t, e);
//     t.getInstance = function () {
//         return AL_APP_SDK_MANAGER.localManager.huoqu_cunchu_lei(t);
//     };
//     t.prototype.zhixing_chushihua_chuli = function () {
//         for (var e = 0; e < l.propnum.length; e++) {
//             l.propnum[e] = AL_GAME_HUA_GameConst.GameConst.getInstance()["prop" + e + "_origin"];
//         }
//         this.chushihua_cunchu_shuju(l);
//         this.chushihua_yuancheng_key([
//             "unlockLevel",
//             "specialUnlockLevel",
//             "starnum",
//             "propnum",
//             "awardnum",
//             "starBoxNum",
//             "specialAwardNum",
//             "todayChallenge",
//             "gameTheme"
//         ]);
//     };
//     t.prototype.shuaxin_riqi_xianguan_shuju = function () {
//         this.todayChallenge = !1;
//         this.todayChallengePop = !0;
//     };
//     t.prototype.jiesuo_xin_guanqia = function (e) {
//         return e > this.unlockLevel && ((this.unlockLevel = e), !0);
//     };
//     t.prototype.huoqu_yijiesuo_guanqia = function () {
//         return this.unlockLevel;
//     };
//     t.prototype.huoqu_dangqian_guanqia = function () {
//         var e;
//         return null !== (e = this.currentLevel) && void 0 !== e ? e : this.unlockLevel;
//     };
//     t.prototype.shezhi_dangqian_guanqia = function () {
//         this.currentLevel = this.unlockLevel;
//     };
//     t.prototype.jiesuo_xin_teshu_guanqia = function (e) {
//         return e > this.specialUnlockLevel && ((this.specialUnlockLevel = e), !0);
//     };
//     t.prototype.huoqu_yijiesuo_teshu_guanqia = function () {
//         var e = AL_GAME_HUA_LevelConfig.LevelConfig.getInstance().huoqu_teshu_guanqia_zong_shuliang();
//         return Math.min(e, this.specialUnlockLevel);
//     };
//     t.prototype.huoqu_dangqian_teshu_guanqia = function () {
//         var e;
//         return null !== (e = this.currentSpecialLevel) && void 0 !== e ? e : this.huoqu_yijiesuo_teshu_guanqia();
//     };
//     t.prototype.shezhi_dangqian_teshu_guanqia = function (e) {
//         this.currentSpecialLevel = e;
//     };
//     t.prototype.youxi_shouci_jinru = function () {
//         this.gametype = !0;
//     };
//     t.prototype.shifou_lao_yonghu = function () {
//         return this.gametype;
//     };
//     t.prototype.huoqu_xingxing_shuliang = function () {
//         return this.starnum;
//     };
//     t.prototype.tianjia_xingxing_shuliang = function (e) {
//         this.starnum += e;
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ADD_STAR_NUM);
//     };
//     t.prototype.huoqu_prop_shuliang = function (e) {
//         return this.propnum[e];
//     };
//     t.prototype.shezhi_prop_shuliang = function (e) {
//         this.propnum = e;
//         this.shezhi_cunchu_shuju("propnum", this.propnum);
//     };
//     t.prototype.genggai_prop_shuliang = function (e, t) {
//         if (void 0 === t) {
//             t = 1;
//         }
//         this.propnum[e] += t;
//         this.shezhi_cunchu_shuju("propnum", this.propnum);
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.CHANGE_PROP_NUM, {
//             idx: e,
//             num: this.propnum[e]
//         });
//     };
//     t.prototype.huoqu_jiangli_shuliang = function () {
//         return this.awardnum;
//     };
//     t.prototype.shezhi_jiangli_shuliang = function () {
//         this.awardnum++;
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.CHANGE_AWARD_NUM, this.awardnum);
//     };
//     t.prototype.huoqu_xingxing_hezi_shuliang = function () {
//         return this.starBoxNum;
//     };
//     t.prototype.tianjia_xingxing_hezi_shuliang = function () {
//         this.starBoxNum++;
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.CHANGE_STAR_BOX, this.starBoxNum);
//     };
//     t.prototype.huoqu_teshu_jiangli_shuliang = function () {
//         return this.specialAwardNum;
//     };
//     t.prototype.shezhi_teshu_jiangli_shuliang = function () {
//         this.specialAwardNum++;
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.CHANGE_SPECIAL_AWARD, this.specialAwardNum);
//     };
//     t.prototype.huoqu_prop_jiesuo = function (e) {
//         return this.propunlock[e] || !1;
//     };
//     t.prototype.shezhi_prop_jiesuo = function (e) {
//         this.propunlock[e] = !0;
//         this.shezhi_cunchu_shuju("propunlock", this.propunlock);
//     };
//     t.prototype.huoqu_dangqian_nandu = function () {
//         return this.curDifficult;
//     };
//     t.prototype.shezhi_dangqian_nandu = function (e) {
//         this.curDifficult = e;
//     };
//     t.prototype.huoqu_tiaozhan_pop = function () {
//         return !this.todayChallenge && !!this.todayChallengePop;
//     };
//     t.prototype.huoqu_jinri_tiaozhan_pop = function () {
//         return this.todayChallengePop;
//     };
//     t.prototype.shezhi_jinri_tiaozhan_pop = function (e) {
//         this.todayChallengePop = e;
//     };
//     t.prototype.huoqu_jinri_tiaozhan = function () {
//         return this.todayChallenge;
//     };
//     t.prototype.shezhi_jinri_tiaozhan = function (e) {
//         this.todayChallenge = e;
//     };
//     t.prototype.huoqu_tiaozhan_riqi = function () {
//         return Math.abs(AL_APP_SDK_MANAGER.utils.huoqu_riqi_jian_de_tianshu_cha(AL_GAME_HUA_Define.Define.CHALLENGE_DATE_SIGN, Date.now()));
//     };
//     t.bundle = AL_GAME_HUA_Define.Define.GAME_NAME;
//     t.key = "_a";
//     return t;
// })($storageClass.AL_Framework_Storage_Class);
// exports.GameData = u;


/** 游戏数据管理 */

const AL_Framework_Storage_Class = require("../../resources/scripts/AL_Framework_Storage_Class");
const HDPP_Define = require("./AL_GAME_HUA_Define");
const HDPP_GameConst = require("./AL_GAME_HUA_GameConst");
const HDPP_LevelConfig = require("./AL_GAME_HUA_LevelConfig");

/** 初始游戏数据配置 */
const gameDataConfig = {
    gametype: false,
    unlockLevel: 1,
    specialUnlockLevel: 1,
    starnum: 0,
    propnum: [3, 3, 3, 10, 10, 10, 10],
    awardnum: 0,
    starBoxNum: 0,
    propunlock: [false, false, false, false, false, false, false],
    curDifficult: 0,
    todayChallenge: false,
    todayChallengePop: true,
    specialAwardNum: 0,
    gameTheme: 1
};

/** 游戏数据管理类 */
class GameDataManager extends AL_Framework_Storage_Class.AL_Framework_Storage_Class {
    useTipsEnter = false;
    useTimeEnter = false;
    useStarEnter = false;
    handleMode = 1;

    static getInstance() {
        return AL_APP_SDK_MANAGER.localManager.huoqu_cunchu_lei(GameDataManager);
    }

    zhixing_chushihua_chuli() {
        gameDataConfig.propnum.forEach((_, index) => {
            gameDataConfig.propnum[index] = HDPP_GameConst.GameConst.getInstance()["prop" + index + "_origin"];
        });
        this.chushihua_cunchu_shuju(gameDataConfig);
        this.chushihua_yuancheng_key([
            "unlockLevel",
            "specialUnlockLevel",
            "starnum",
            "propnum",
            "awardnum",
            "starBoxNum",
            "specialAwardNum",
            "todayChallenge",
            "gameTheme"
        ]);
    }

    shuaxin_riqi_xianguan_shuju() {
        this.todayChallenge = false;
        this.todayChallengePop = true;
    }

    jiesuo_xin_guanqia(level) {
        if (level > this.unlockLevel) {
            this.unlockLevel = level;
            return true;
        }
        return false;
    }

    huoqu_yijiesuo_guanqia() {
        return this.unlockLevel;
    }

    huoqu_dangqian_guanqia() {
        return this.currentLevel ?? this.unlockLevel;
    }

    shezhi_dangqian_guanqia() {
        this.currentLevel = this.unlockLevel;
    }

    jiesuo_xin_teshu_guanqia(level) {
        if (level > this.specialUnlockLevel) {
            this.specialUnlockLevel = level;
            return true;
        }
        return false;
    }

    huoqu_yijiesuo_teshu_guanqia() {
        const maxSpecialLevel = HDPP_LevelConfig.LevelConfig.getInstance().huoqu_teshu_guanqia_zong_shuliang();
        return Math.min(maxSpecialLevel, this.specialUnlockLevel);
    }

    huoqu_dangqian_teshu_guanqia() {
        return this.currentSpecialLevel ?? this.huoqu_yijiesuo_teshu_guanqia();
    }

    shezhi_dangqian_teshu_guanqia(level) {
        this.currentSpecialLevel = level;
    }

    youxi_shouci_jinru() {
        this.gametype = true;
    }

    shifou_lao_yonghu() {
        return this.gametype;
    }

    huoqu_xingxing_shuliang() {
        return this.starnum;
    }

    tianjia_xingxing_shuliang(num) {
        this.starnum += num;
        AL_APP_SDK_MANAGER.emit(HDPP_Define.GameEvent.ADD_STAR_NUM);
    }

    huoqu_prop_shuliang(index) {
        return this.propnum[index];
    }

    shezhi_prop_shuliang(props) {
        this.propnum = props;
        this.shezhi_cunchu_shuju("propnum", this.propnum);
    }

    genggai_prop_shuliang(index, num = 1) {
        this.propnum[index] += num;
        this.shezhi_cunchu_shuju("propnum", this.propnum);
        AL_APP_SDK_MANAGER.emit(HDPP_Define.GameEvent.CHANGE_PROP_NUM, { idx: index, num: this.propnum[index] });
    }

    huoqu_jiangli_shuliang() {
        return this.awardnum;
    }

    shezhi_jiangli_shuliang() {
        this.awardnum++;
        AL_APP_SDK_MANAGER.emit(HDPP_Define.GameEvent.CHANGE_AWARD_NUM, this.awardnum);
    }

    huoqu_xingxing_hezi_shuliang() {
        return this.starBoxNum;
    }

    tianjia_xingxing_hezi_shuliang() {
        this.starBoxNum++;
        AL_APP_SDK_MANAGER.emit(HDPP_Define.GameEvent.CHANGE_STAR_BOX, this.starBoxNum);
    }

    huoqu_teshu_jiangli_shuliang() {
        return this.specialAwardNum;
    }

    shezhi_teshu_jiangli_shuliang() {
        this.specialAwardNum++;
        AL_APP_SDK_MANAGER.emit(HDPP_Define.GameEvent.CHANGE_SPECIAL_AWARD, this.specialAwardNum);
    }

    huoqu_prop_jiesuo(index) {
        return this.propunlock[index] || false;
    }

    shezhi_prop_jiesuo(index) {
        this.propunlock[index] = true;
        this.shezhi_cunchu_shuju("propunlock", this.propunlock);
    }

    huoqu_dangqian_nandu() {
        return this.curDifficult;
    }

    shezhi_dangqian_nandu(difficulty) {
        this.curDifficult = difficulty;
    }

    huoqu_tiaozhan_pop() {
        return !this.todayChallenge && !!this.todayChallengePop;
    }

    huoqu_jinri_tiaozhan_pop() {
        return this.todayChallengePop;
    }

    shezhi_jinri_tiaozhan_pop(state) {
        this.todayChallengePop = state;
    }

    huoqu_jinri_tiaozhan() {
        return this.todayChallenge;
    }

    shezhi_jinri_tiaozhan(state) {
        this.todayChallenge = state;
    }

    huoqu_tiaozhan_riqi() {
        return Math.abs(AL_APP_SDK_MANAGER.utils.huoqu_riqi_jian_de_tianshu_cha(HDPP_Define.Define.CHALLENGE_DATE_SIGN, Date.now()));
    }
}

GameDataManager.bundle = HDPP_Define.Define.GAME_NAME;
GameDataManager.key = "_a";
exports.GameData = GameDataManager;